﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WpfAGVSystem.Common;

namespace WpfAGVSystem.DBModel
{
    [Table("Station_Entity")]
    public class Station_Entity:BaseDbmodel
    {

        public int id { get; set; }
        public int station { get; set; }
        public double X { get; set; }
        public double Y { get; set; }

        /// <summary>
        /// 地图
        /// </summary>
        public int? Map { get; set; }
        private string groupId;
        public string Groupid
        {
            get
            {
                return groupId;
            }
            set
            {
                groupId = value;
                string[] groupids = StringProcess.Split(groupId);
                int number = 0;
                grps = new List<int>();
                foreach (string groupid in groupids)
                {
                    if (int.TryParse(groupid, out number))
                    {
                        grps.Add(number);
                    }
                }
            }
        }
        public string Remark { get; set; }
        //站点所在的组
        public List<int> grps;
        public Station_Entity Clone()
        {
            Station_Entity t = new Station_Entity()
            {
                station = this.station,
                X = this.X,
                Y = this.Y,            
                Groupid = this.Groupid,
                Remark = this.Remark
            };
            return t;
        }
    }
}
